﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;


using CRM.Entity;
using CRM.Entity.Extra;
using CRM.DataService;
using CRM.Entity.Page;
using CRM.Controller.Validation;

namespace CRM.Controller
{
    public partial class Sys_UserInfo_Controller
    {
        //对数据层的服务类
        Sys_UserInfo_DataService dataService;

        public Sys_UserInfo_Controller()
        {
            dataService = new Sys_UserInfo_DataService();
        }

        public List<Sys_UserInfo> GetAll()
        {
            return dataService.GetAll();
        }

        public Sys_UserInfoPage GetList(PageInfo page)
        {
            return dataService.GetList(page);
        }

        public Sys_UserInfoPage GetList(Func<Sys_UserInfo, bool> func)
        {
            return dataService.GetList(func);
        }

        public Sys_UserInfoPage GetList(PageInfo page, Func<Sys_UserInfo, bool> func)
        {
            return dataService.GetList(page, func);
        }

        public List<Sys_UserInfo> GetListTop(int top, Func<Sys_UserInfo, bool> func)
        {
            return dataService.GetListTop(top, func);
        }

        public Sys_UserInfo GetSingle(int sys_UserInfoID)
        {
            return dataService.GetSingle(sys_UserInfoID);
        }

        public Sys_UserInfo GetSingleMultiple(Func<Sys_UserInfo, bool> func)
        {
            return dataService.GetSingleMultiple(func);
        }

        public bool Add(Sys_UserInfo sys_UserInfo)
        {               
            //先对字段的输入验证
            if (!InputValidation.CheckSys_UserInfo(sys_UserInfo))
                return false;
                
            bool isSuccess = dataService.Add(sys_UserInfo);

            return isSuccess;
        }
        
        public bool AddBatch(List<Sys_UserInfo> list)
        {    
            //先对字段的输入验证
            foreach(var item in list)
            {
                if (!InputValidation.CheckSys_UserInfo(item))
                return false;
            }
            
            bool isSuccess = dataService.AddBatch(list);

            return isSuccess;
        }

        public bool Update(Sys_UserInfo sys_UserInfo)
        {
            //先对字段的输入验证
            if (!InputValidation.CheckSys_UserInfo(sys_UserInfo))
                return false;
               
            bool isSuccess = dataService.Update(sys_UserInfo);

            return isSuccess;
        }
        
        public bool UpdateBatch(List<Sys_UserInfo> list)
        {
            //先对字段的输入验证
            foreach(var item in list)
            {
                if (!InputValidation.CheckSys_UserInfo(item))
                return false;
            }
            
            bool isSuccess = dataService.UpdateBatch(list);

            return isSuccess;
        }

        public bool Delete(Sys_UserInfo sys_UserInfo)
        {
            //先对字段的输入验证
            if (!InputValidation.CheckSys_UserInfo(sys_UserInfo))
                return false;
           
            bool isSuccess = dataService.Delete(sys_UserInfo);

            return isSuccess;
        }
    }
}





